// 采购入库作业 API
import request from "@/utils/request";

// 采购入库作业 VO 定义（JavaScript 对象形式）
export const PoStockInMainVO = {
  // 主键ID
  id: 0,
  // 入库申请单
  mainNo: "",
  // 入库类型
  inType: "",
  // 业务类型
  ywInType: "",
  // 仓库编码
  warehouseCode: "",
  // 仓库名称
  warehouseName: "",
  // 业务日期
  ywDate: null,
  // 合同号
  poContractCode: "",
  // 合同类型
  orderType: "",
  // 合同行号
  poContractDetailCode: "",
  // 供应商编码
  suppNo: "",
  // 供应商名称
  suppName: "",
  // 删除人
  deleter: "",
  // 删除时间
  deleteTime: null,
  // 业务状态
  busStatus: "",
  // 业务备注
  busMemo: "",
  // 预留字段
  reserveVarchar1: "",
  reserveVarchar2: "",
  reserveVarchar3: "",
  reserveVarchar4: "",
  reserveDecimal1: 0,
};

// 采购入库作业 API
export const PoStockInMainApi = {
  // 查询采购入库作业分页
  getPoStockInMainPage: function (params) {
    return request({
      method: "get",
      url: "/wm/po-stock-in-main/page",
      params: params,
    });
  },

  // 查询采购入库作业详情
  getPoStockInMain: function (id) {
    return request({
      method: "get",
      url: "/wm/po-stock-in-main/get?id=" + id,
    });
  },

  // 新增采购入库作业
  createPoStockInMain: function (data) {
    return request({
      method: "post",
      url: "/wm/po-stock-in-main/create",
      data: data,
    });
  },

  // 修改采购入库作业
  updatePoStockInMain: function (data) {
    return request({
      method: "put",
      url: "/wm/po-stock-in-main/update",
      data: data,
    });
  },

  // 删除采购入库作业
  deletePoStockInMain: function (id) {
    return request({
      method: "delete",
      url: "/wm/po-stock-in-main/delete?id=" + id,
    });
  },

  // 导出采购入库作业 Excel
  exportPoStockInMain: function (params) {
    return request({
      method: "get",
      url: "/wm/po-stock-in-main/export-excel",
      params: params,
      responseType: "blob",
    });
  },

  // ==================== 子表（采购入库） ====================

  // 获得采购入库分页
  getPoStockInPage: function (params) {
    return request({
      method: "get",
      url: "/wm/po-stock-in-main/po-stock-in/page",
      params: params,
    });
  },

  // 新增采购入库
  createPoStockIn: function (data) {
    return request({
      method: "post",
      url: "/wm/po-stock-in-main/po-stock-in/create",
      data: data,
    });
  },

  // 修改采购入库
  updatePoStockIn: function (data) {
    return request({
      method: "put",
      url: "/wm/po-stock-in-main/po-stock-in/update",
      data: data,
    });
  },

  // 删除采购入库
  deletePoStockIn: function (id) {
    return request({
      method: "delete",
      url: "/wm/po-stock-in-main/po-stock-in/delete?id=" + id,
    });
  },

  // 获得采购入库
  getPoStockIn: function (id) {
    return request({
      method: "get",
      url: "/wm/po-stock-in-main/po-stock-in/get?id=" + id,
    });
  },
};

export default PoStockInMainApi;